import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import { terser } from 'rollup-plugin-terser';
// https://vitejs.dev/config/
export default defineConfig({
	plugins: [vue()],
	server: {
		open: true,
		host: true
	},
	build: {
		target: 'es2015',
		lib: {
			entry: {
				'davinci-block': './src/davinci-block/index.ts',
				'davinci-link': './src/davinci-link/index.ts',
				'davinci-image': './src/davinci-image/index.ts',
				'davinci-media': './src/davinci-media/index.ts'
			},
			formats: ['es'],
			fileName(format, entryName) {
				return `${entryName}.${format}.js`;
			}
		},
		rollupOptions: {
			plugins: [
				terser({
					compress: {
						drop_console: true,
						ecma: 5
					}
				})
			],
			external: ['@wangeditor/editor']
		}
	}
});
